package star.trek.voyager.module.common.etasocket_common;

import org.jiopi.framework.annotation.module.RegisterModule;
import star.trek.voyager.blueprint.axletree_socket.AxletreeSocket;
import star.trek.voyager.blueprint.etasocket.ETASocket;
import star.trek.voyager.blueprint.status.Status;

@RegisterModule
public class CommonETASocket implements ETASocket , Status{
	
	private Status statusAbleModule = null;
	private AxletreeSocket axletreeSocket =null;

	public void socket(AxletreeSocket axletreeSocket) {
		this.axletreeSocket = axletreeSocket;
		//System.out.println("CommonETASocket socket axletreeSocket : "+axletreeSocket);
	}

	public void socket(Status statusAbleModule) {
		if(this.statusAbleModule == null){
			this.statusAbleModule = statusAbleModule;
			//System.out.println("CommonETASocket socket statusAbleModule : "+statusAbleModule);
		}
	}

	public String checkStatus() {
		//System.out.println("CommonETASocket checkStatus axletreeSocket "+axletreeSocket+" statusAbleModule "+statusAbleModule);
		if(axletreeSocket!=null) return "====CommonETASocket status:ok====\n\n"+statusAbleModule.checkStatus()+"====over====\n";
		return "====CommonETASocket status:\nAxletreeSocket not Connect!====\n====over====\n\n";
	}
	
	public String toString(){
		return this.getClass().getName()+"-0.1.0.0";
	}

}
